package com.zy.test.widget

import android.content.Intent
import com.zy.activity.BaseMenuActivity
import com.zy.activity.bean.BaseMenuBean
import com.zy.test.widget.WidgetConstant.WIDGET_TYPE
import com.zy.test.widget.WidgetConstant.WIDGET_TYPE_BOTTOMNAVIGATIONVIEW
import com.zy.test.widget.WidgetConstant.WIDGET_TYPE_JETPACK_CARD_VIEW
import com.zy.test.widget.WidgetConstant.WIDGET_TYPE_JETPACK_EMOJI
import com.zy.test.widget.WidgetConstant.WIDGET_TYPE_RADIO_GROUP
import com.zy.test.widget.WidgetConstant.WIDGET_TYPE_SETTINGS
import java.util.ArrayList

class WidgetListMainActivity : BaseMenuActivity() {

    override fun init(list: ArrayList<BaseMenuBean>) {
        list.add(BaseMenuBean("View"))
        list.add(BaseMenuBean("界面"))
        list.add(BaseMenuBean("SettingsFragment", 3, WIDGET_TYPE_SETTINGS))
        list.add(BaseMenuBean("ViewGroup"))
        list.add(BaseMenuBean("顶部导航", 1))
        list.add(BaseMenuBean("底部导航1", 2))
        list.add(BaseMenuBean("底部导航2", 3, WIDGET_TYPE_BOTTOMNAVIGATIONVIEW))
        list.add(BaseMenuBean("底部导航3", 3, WIDGET_TYPE_RADIO_GROUP))
        list.add(BaseMenuBean("jetpack"))
        list.add(BaseMenuBean("Cardview", 3, WIDGET_TYPE_JETPACK_CARD_VIEW))
        //list.add(BaseMenuBean("Emoji", 3, WIDGET_TYPE_JETPACK_EMOJI))
    }

    override fun clickItem(bean: BaseMenuBean) {
        when (bean.code) {
            1 -> {
                startActivity(Intent(this, TabLayoutTest1Activity::class.java))
            }
            2 -> {
                startActivity(Intent(this, TabLayoutTest2Activity::class.java))
            }
            3 -> {
                startActivity(Intent(this, WidgetMainActivity::class.java).apply {
                    putExtra(WIDGET_TYPE, bean.widgetType)
                })
            }
        }
    }
}